home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCommon / Include / SLPriMem.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  3.0 KB  |  88 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLPriMem.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SLPRIMEM_H
  11. #define SLPRIMEM_H
  12.  
  13. #ifndef FWSTDDEF_H
  14. #include "FWStdDef.h"
  15. #endif
  16.  
  17. #include <stddef.h>
  18.  
  19. // Export or Import functions for CFM-68K [sfu]
  20.  
  21. #if defined(FW_ODFLIB_IMPORT)
  22. #pragma import on
  23. #elif defined(FW_ODFLIB)
  24. #pragma export on
  25. #endif
  26.  
  27. extern "C" 
  28. {
  29.  
  30. //----------------------------------------------------------------------------------------
  31. // Primitive Memory Operations
  32. //
  33. //    These functions provide a platform-independent interface to low level operating
  34. //    system services for memory management.  The functions impose minimal requirements
  35. //    on the underlying environment, and are built in the simplest way on top of native
  36. //    operating system APIs.  Requirements for parameter validation and error handling
  37. //    are minimal: it is the clients responsiblity to provide valid parameters!
  38. //
  39. //    Memory blocks allocated and freed by these functions can be as large as can be
  40. //    requested with a size_t parameter, but these routines should generally not be
  41. //    used for large allocations.
  42. //
  43. //    This function are intended for use by very low-level code.  Applications, Component
  44. //    Editors (and most of ODF) should use higher level interfaces.
  45. //
  46. //----------------------------------------------------------------------------------------
  47.  
  48. void * FW_PrimitiveAllocateBlock(size_t bytesRequested);
  49.     // Operation is undefined for bytesRequested == 0
  50.     // Operation is also undefined if a signed negative value is passed in for bytesRequested.
  51.     // Returns 0 if request could not be satisfied due to insufficient memory.
  52.     
  53. void * FW_PrimitiveResizeBlock(void *block, size_t bytesRequested);
  54.     // The block may be moved to satisfy request.
  55.     // Returns 0 if request could not be satisfied.
  56.     // Resize of NULL or invalid block is undefined (platform-dependent).
  57.     
  58. void FW_PrimitiveFreeBlock(void *block);
  59.     // Free of invalid block is undefined (platform-dependent).
  60.     // It is a no-op to try to free NULL.
  61.  
  62. size_t FW_PrimitiveGetBlockSize(void* p);
  63.     // Returns size in bytes.
  64.     // Size of NULL or invalid block is undefined (platform-dependent).
  65.  
  66. void FW_PrimitiveCopyMemory(const void *source, void *destination, size_t bytes);
  67.     // Copy from source to destination.
  68.     // Source and destination may be overlapping.
  69.     // No error detection provided, i.e. it is assumed that both the source and destination 
  70.     // buffers are at least 'bytes' long.
  71.  
  72. void FW_PrimitiveSetMemory(void* block, size_t bytes, unsigned char value);
  73.     // Sets every byte of the block to value
  74.     // No error detection provided, i.e. it is assumed that block is at least 'bytes' long. 
  75.  
  76. // FW_EXTERN_C_END
  77. }
  78.  
  79. // For CFM-68K [sfu]
  80.  
  81. #if defined(FW_ODFLIB_IMPORT)
  82. #pragma import off
  83. #elif defined(FW_ODFLIB)
  84. #pragma export off
  85. #endif
  86.  
  87. #endif
  88.